package com.ucampus.service;

import com.ucampus.dao.ManagerDao;
import com.ucampus.entity.Manager;
import com.ucampus.entity.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ManagerLoginService {
    @Autowired
    private ManagerDao managerDao;

    public ResponseData login(String username, String password) {
        ResponseData responseData = new ResponseData();
        Manager manager=managerDao.select(username);
        if(manager==null){
            responseData.setMessage("账号或密码错误");
        }else {
            if (manager.getPassword().equals(password)) {
                responseData.setMessage("登录成功");
                responseData.setData(manager);
            } else {
                responseData.setMessage("账号或密码错误");
            }
        }
        return responseData;
    }
}
